package pojo;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

//评价
@Data
public class Evaluate implements Serializable {
    //评价的用户id
    private String  userId;
    //评价的电影id
    private String movieId;
    //评价分数
    private Integer score;

    //评价时间
    private Time time;

    //全参构造(还是传入字符串)
    public Evaluate(String userId, String movieId, String  score, String  time) {
        this.userId = userId;
        this.movieId = movieId;
        this.score = Integer.parseInt(score);
        this.time = new Time(time);
    }

    //equals和hashCode方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Evaluate evaluate = (Evaluate) o;
        return userId.equals(evaluate.userId) && movieId.equals(evaluate.movieId);
    }
    @Override
    public int hashCode() {
        return Objects.hash(userId, movieId);
    }

}
